//拦截器 拦截只要是未登录状态，想要跳转到名单内的路径时，直接跳到登录页。
// 页面名单
const whiteList = [
	'/pages/footprint/footprint',
	'/pages/AddAddress/AddAddress',
	'/pages/sort/sort',
	'/pages/order/order?index=3',
	'/pages/order/order?index=4',
	'/pages/order/order?index=1',
	'/pages/order/order?index=2',
	'/pages/pay/pay'
]

uni.addInterceptor('navigateTo', {
	// tabbar页面跳转前进行拦截
	invoke (e) {
		if (!uni.getStorageSync('uid') && (e.url==whiteList[0] || e.url==whiteList[1] || e.url==whiteList[2] || e.url==whiteList[3]||
		e.url==whiteList[4]|| e.url==whiteList[5]|| e.url==whiteList[6] || e.url==whiteList[7] )) {
			uni.$emit('navigateTo',true);
			alert('请先登录')
			uni.navigateTo({
				url: '/pages/RegisterLogin/RegisterLogin'
			});
			return false
		} else{
			return true
		}
	},
	success (e) {
		// console.log(e)
	}
})
